import { http } from "@/utils";

//1.获取频道列表
export function getChannelsAPI(){
    return http({
        url:'/channels',
        method:'get'
    })
}

//2.提交文章表单(新增文章)
export function createArticleAPI(data){
    return http({
        url:`/mp/articles?draft=false`,
        method:'post',
        data
    })
}

//3.获取文章列表
export function getArticleListAPI(params){
    return http({
        url:'/mp/articles',
        method:'get',
        params
    })
}

//4.删除某项文章列表
export function delArticleAPI(id){
    return http({
        url:`/mp/articles/${id}`,
        method:'delete'
    })
}

//d获取文章数据
export function getArticleById(id){
    return http({
        url:`/mp/articles/${id}`,
        method:'get'
    })
}

//更新文章
export function updateArticleAPI(data){
    return http({
        url:`/mp/articles/${data.id}?draft=false`,
        method:'put',
        data
    })
}
